﻿using System;
using System.Collections.Generic;
using System.Text;

namespace FySystem.Extension
{
    public class NumberExtension
    {
        /// <summary>
        /// 找出数组中的最大值
        /// </summary>
        /// <param name="sources"></param>
        /// <returns></returns>
        public static double Greatest(params double[] sources)
        {
            double res = double.MinValue;
            try
            {
                if (sources == null)
                    throw new Exception("传入参数为空~");
                if (sources.Length == 0)
                    throw new Exception("传入参数为空~");

                foreach(double item in sources)
                {
                    if (item > res)
                        res = item;
                }
            }
            catch (Exception)
            {
                throw;
            }
            return res;
        }
    }
}
